<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>新增客户</title>
    <link rel="stylesheet" href="__STATIC__/bootstrap/css/bootstrap.full.css">
    <link rel="stylesheet" href="__STATIC__/bootstrap/css/bootstrap-datepicker.min.css">
    <script src="__STATIC__/easyui/js/jquery.min.js" type="text/javascript"></script>
    <script src="__STATIC__/bootstrap/js/bootstrap.min.js"></script>
    <script src="__STATIC__/bootstrap/js/bootstrap-datepicker.min.js"></script>
    <script src="__STATIC__/bootstrap/js/bootstrap-datepicker.zh-CN.min.js"></script>
    <style>
        .form-group{padding-bottom: 15px;}
        .control-label{text-align: right;/* width: 20%; */margin-right: 2%;}
        .form-control{width: 60%!important;}
        .line{border-bottom: 1px dashed #ccc;text-align: center;color: #888;margin-bottom: 20px;}
        /* .btns{text-align: center;} */
        #msg{color: #f00;}
        .close{display: none;}
    </style>
</head>

<body>

    {include file="public/userAddForm"}

    <script>
		$(function() {
		    $('#myModal').modal({
		        backdrop: false,
		    });
		    $('#submit').on('click', function() {
		        $.ajax({
	                url: '{:url("useradd")}?r='+Math.random(),
	                type: 'POST',
	                dataType: 'html',
	                data: $('#formdata').serialize()
	            })
	            .done(function(data) {
	                // console.log(data);
	                $('#msg').html('提示信息：' + data);
	                if (data == '"客户添加成功!"') {
	                    $('#submit').attr('disabled', true);
	                    $('#formdata').get(0).reset();
	                    $('#msg').html('');
	                    // $('#myModal').modal('hide');
	                    $('#addUserDialog').modal();
	                    $('#submit').attr('disabled', false);
	                }
	            })
	            .fail(function() {
	                alert("发生错误");
	            });

		        return false;

		    })
		})
	</script>

</body>

</html>
